/**
* @Title: AuthDBDaoImpl.java
* @Package com.yly.module.sys.security.dynamic.auth.impl
* @Description: TODO
* @author zz
* @date 2014-3-15 下午9:19:53
* @version V1.0
*/
package com.yly.module.sys.security.dynamic.auth.impl;

import java.util.List;
import java.util.Map;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.stereotype.Repository;

import com.yly.common.basic.dao.BasicSupportDao;
import com.yly.module.sys.security.dynamic.auth.IAuthDao;

/**
 * @ClassName: AuthDBDaoImpl
 * @Description: TODO
 * @author zz
 * @date 2014-3-15 下午9:19:53
 */
@Repository
public class AuthDBDaoImpl extends BasicSupportDao implements IAuthDao {
	
	protected static Log log = LogFactory.getLog(AuthDBDaoImpl.class);

	/* (非 Javadoc)
	 * <p>Title: loadFilterChainDefinitions</p>
	 * <p>Description: </p>
	 * @return
	 * @see com.yly.module.sys.security.dynamic.auth.IAuthDao#loadFilterChainDefinitions()
	 */
	@SuppressWarnings({ "unchecked", "rawtypes" })
	@Override
	public String loadFilterChainDefinitions() {
		List<Map> list = this.selectList(null);
		StringBuilder sb = new StringBuilder("");
		for(Map<String, String> m : list){
			String url = m.get("URL");
			String expression = m.get("EXPRESSION");
			sb.append(url).append(EQ).append(expression).append(CRLF);
		}
//		sb.append("/login.jsp=anon").append(CRLF)
//		.append("/images/**=anon").append(CRLF)
//		.append("/script/**=anon").append(CRLF)
//		.append("/style/**=anon").append(CRLF)
//		.append("/page/**=anon").append(CRLF)
//		.append("/sys/security/login.xhtml=anon").append(CRLF)
//		.append("/sys/security/logout.xhtml=authc").append(CRLF)
//		.append("/sys/home/getTop.xhtml=authc,perms[1]").append(CRLF)
//		.append("/sys/home/getLeft.xhtml=authc,perms[1]").append(CRLF)
//		.append("/sys/home/getRight.xhtml=authc").append(CRLF)
//		.append("/sys/home/getChannel.xhtml=authc").append(CRLF);
		return sb.toString();

	}

}
